#ifndef _RECOGNIZER_H
#define _RECOGNIZER_H
#pragma once

#include <sapi.h>
#include <sphelper.h>
#include <atlbase.h>
#include <queue>
#include "../common/configure.h"
#include "../common/Ptr.hpp"
#include "../common/request.h"

using namespace std;

#define VID_Create 1
#define VID_Army 2
#define VID_Move 3
#define VID_Select 4
#define VID_Fight 5
#define VID_Delete 6


class Recognizer{
private:
  // represent a single speech recognition engine
  CComPtr< ISpRecognizer > _cpRecoEngine;
  // represent a recognition context
  CComPtr< ISpRecoContext > _cpRecoContext;
  // defines the grammar rule
  CComPtr< ISpRecoGrammar > _cpGrammar;
  
  Ptr< queue< Request > > _pRequestQueue;
  float* _pXSpace;
  float* _pYSpace;

  // create speech recognizer engine and context
  bool _init ();
  // load grammar file
  bool _load_grammar (wchar_t* file);
  void _recognize ();
  void _gen_request (Request::RequestType type, char *object);

public:
	Recognizer (Ptr< queue< Request > > pRequestQueue, float* pX, float* pY);

	void startup ();

};

#endif